Skip to content

rogitproxy: add read-only GitHub API proxy - #2

Open
bradfitz wants to merge 1 commit into
mainfrom
bradfitz/gh-api-ro-proxy
Open

bradfitz wants to merge 1 commit into
mainfrom
bradfitz/gh-api-ro-proxy

Conversation

@bradfitz

Copy link
Copy Markdown
Member

Sandboxed VMs can clone via rogitproxy without credentials, but tooling
in them also needs to read PR checks, Actions run status and failure
logs, issues, and PR/review comments. Add an unauthenticated (from the
client's view) GitHub API proxy that grants what a read-only
collaborator on the caller's granted repos could see on the website.

It is laid out like GitHub Enterprise Server (/api/v3/ for REST,
/api/graphql for GraphQL) and is also served over HTTPS on :443 with
the tailnet cert, so the gh CLI works with GH_HOST pointed at the proxy
and no TLS MITM or custom root certs. gh even detects the repo from
git:// remotes cloned from rogitproxy.

Safety is layered: upstream requests use GitHub App installation tokens
downscoped to read-only permissions and the caller's granted repos;
REST is limited to GET/HEAD under /repos/{owner}/{repo}/ with a pull
grant on that repo; GraphQL documents are parsed and anything but
queries is rejected; client auth headers are dropped; and redirects
(e.g. Actions log downloads to blob storage) are followed server-side
without the token. API URLs in JSON bodies and Link headers are
rewritten to point back at the proxy so pagination works.

The GitHub App needs read permissions for actions, checks, issues,
pull_requests, and statuses added for the scoped tokens to be minted.

Updates tailscale/corp#51474

Sandboxed VMs can clone via rogitproxy without credentials, but tooling
in them also needs to read PR checks, Actions run status and failure
logs, issues, and PR/review comments. Add an unauthenticated (from the
client's view) GitHub API proxy that grants what a read-only
collaborator on the caller's granted repos could see on the website.

It is laid out like GitHub Enterprise Server (/api/v3/ for REST,
/api/graphql for GraphQL) and is also served over HTTPS on :443 with
the tailnet cert, so the gh CLI works with GH_HOST pointed at the proxy
and no TLS MITM or custom root certs. gh even detects the repo from
git:// remotes cloned from rogitproxy.

Safety is layered: upstream requests use GitHub App installation tokens
downscoped to read-only permissions and the caller's granted repos;
REST is limited to GET/HEAD under /repos/{owner}/{repo}/ with a pull
grant on that repo; GraphQL documents are parsed and anything but
queries is rejected; client auth headers are dropped; and redirects
(e.g. Actions log downloads to blob storage) are followed server-side
without the token. API URLs in JSON bodies and Link headers are
rewritten to point back at the proxy so pagination works.

The GitHub App needs read permissions for actions, checks, issues,
pull_requests, and statuses added for the scoped tokens to be minted.

Updates tailscale/corp#51474

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: Ic74e6727544f51b862ffea6719b70f1f04b0ffdf
@bradfitz
bradfitz requested review from a team and BeckyPauley November 13, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants